<template>
    <div class="board">
        <div class="top">
            <div class="top-left r">
                <div class="title">
                    <div class="title-txt">当日出入库任务完成情况</div>
                    <div class="lendge">
                        <div class="lendge-finish">已完成</div>
                        <div class="lendge-nofinish">未完成</div>
                    </div>
                </div>
                <div class="box">
                    <div class="top-left-chart-box">
                        <div class="top-left-chart1" id="top-left-chart1"></div>
                        <div class="top-left-chart2" id="top-left-chart2"></div>
                    </div>
                </div>
            </div>
            <div class="top-center r">
                <div class="title">
                    <div class="title-txt">本周超时处理时长统计</div>
                </div>
                <div class="box">
                    <div class="top-center-chart-box">
                        <div class="top-center-chart1" id="top-center-chart1"></div>
                        <div class="top-center--box">
                            <div class="title-label t1">0-30分钟</div>
                            <div class="title-label t31">31-60分钟</div>
                            <div class="title-label t61">61-90分钟</div>
                            <div class="title-label t91">91-120分钟</div>
                            <div class="title-label t120">120分钟以上</div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="top-right r">
                <div class="title">
                    <div class="title-txt">本周单据处理时长统计</div>
                </div>
                <div class="box">
                    <div class="top-right-chart-box">
                        <div class="top-right-chart1" id="top-right-chart1">
                            <div class="top-right-item" v-for="(item,index) in lists" :key="index">
                                <div class="top-right-item-txt">{{ item.label }}</div>
                                <div class="top-right-item-progress">
                                    <div class="progress-bg" :style="{'backgroundColor':item.color,'width':item.rate?item.rate+'%':'0%'}"></div>
                                </div>
                                <div class="top-right-item-num">{{ item.value }}</div>
                            </div>
    
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="center">
            <div class="center-left r">
                <div class="title">
                    <div class="title-txt">库存周转率</div>
                    <div class="title-select">
                        <el-select size="mini">
                            <el-option></el-option>
                        </el-select>
                    </div>
                </div>
                <div class="box r">
                    <div class="center-left-chart-box">
                        <div class="center-left-chart1" id="center-left-chart1"></div>
                    </div>
                </div>
            </div>
            <div class="center-right r">
                <div class="title">
                    <div class="title-txt">物料消耗差异对比TOP10</div>
                    <div class="title-select">
                        <el-select size="mini">
                            <el-option></el-option>
                        </el-select>
                    </div>
                </div>
                <div class="box r">
                    <div class="center-left-chart-box">
                        <div class="center-left-chart1" id="center-right-chart1"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="bottom">
            <div class="bottom-left r">
                <div class="title">
                    <div class="title-txt">呆滞物料占比TOP10</div>
                  
                </div>
                <div class="box r">
                    <div class="center-left-chart-box">
                        <div class="center-left-chart1" id="bottom-left-chart1"></div>
                    </div>
                </div>
            </div>
            <div class="bottom-right r">
                <div class="title">
                    <div class="title-txt">超期物料占比TOP10</div>
                  
                </div>
                <div class="box r">
                    <div class="center-left-chart-box">
                        <div class="center-left-chart1" id="bottom-right-chart1"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import * as echarts from 'echarts';
import { badnessOption, badnessOptions, badnessAreaOption, lineOption, barOption,materilaOption,dzption,cqption } from './options'
export default {
    data() {
        return {
            lists:[
                {
                    label:'采购入库',
                    value:'',
                    color:'#A3DFEF',
                    rate:'50'
                },
                {
                    label:'生产入库',
                    value:'',
                    color:'#84CFA7',
                    rate:'50'
                },
                {
                    label:'退料入库',
                    value:'',
                    color:'#F2BC7D',
                    rate:'50'
                },
                {
                    label:'其它入库',
                    value:'',
                    color:'#636FEC',
                    rate:'50'
                },
                {
                    label:'领料出库',
                    value:'',
                    color:'#0085D5',
                    rate:'50'
                },
                {
                    label:'销售出库',
                    value:'',
                    color:'#23B500',
                    rate:'50'
                },
                {
                    label:'其他出库',
                    value:'',
                    color:'#FF8900',
                    rate:'50'
                },
            ]
        }
    },
    mounted() {
        this.renderOutChart() // 当日出库任务完成情况
        this.renderInChart() // 当日入库任务完成情况
        this.renderOvertimeChart() // 本周超时处理时长统计
        //this.renderDurationChart()  // 本周单据处理时长统计 
        this.renderStore() // 库存周转率
        this.renderMaterial() // 物料消耗差异对比TOP10
        this.renderdzption() // 呆滞物料占比TOP10
        this.rendercqption() // 超期物料占比TOP10
    },
    methods: {
        renderOutChart() {
            var chartDom = document.getElementById('top-left-chart1');
            var myChart = echarts.init(chartDom);
            myChart.setOption(badnessOption);
        },
        renderInChart() {
            var chartDom = document.getElementById('top-left-chart2');
            var myChart = echarts.init(chartDom);
            myChart.setOption(badnessOptions);
        },
        renderOvertimeChart() {
            var chartDom = document.getElementById('top-center-chart1');
            var myChart = echarts.init(chartDom);
            myChart.setOption(badnessAreaOption);
        },
        renderDurationChart() {
            var chartDom = document.getElementById('top-right-chart1');
            var myChart = echarts.init(chartDom);
            myChart.setOption(barOption);
        },
        renderStore(){
            var chartDom = document.getElementById('center-left-chart1');
            var myChart = echarts.init(chartDom);
            myChart.setOption(lineOption);
        },
        renderMaterial(){
            var chartDom = document.getElementById('center-right-chart1');
            var myChart = echarts.init(chartDom);
            myChart.setOption(materilaOption);
        },
        renderdzption(){
            var chartDom = document.getElementById('bottom-left-chart1');
            var myChart = echarts.init(chartDom);
            myChart.setOption(dzption); 
        },
        rendercqption(){
            var chartDom = document.getElementById('bottom-right-chart1');
            var myChart = echarts.init(chartDom);
            myChart.setOption(cqption); 
        },
    }
}
</script>
<style lang="scss" scoped>
.title {
    height:51px;
    position: relative;
    display: flex;
    align-items: center;
    padding-left: 12px;
    padding-right: 30px;
    justify-content: space-between;

    .title-txt {
        font-family: Source Han Sans CN, Source Han Sans CN;
        font-weight: 400;
        font-size: 16px;
        color: #000000;
        line-height: 24px;
        padding-left: 8px;
        height: 24px;
        position: relative;

        &::after {
            position: absolute;
            content: "";
            width: 4px;
            height: 14px;
            background-color: #2EBE87;
            left: 0;
            top: 6px;
        }

    }
}

.r {
    background-color: #fff;
}

.board {
    padding: 6px 0px 0px;
    background-color: #efefef;
    display: grid;
    box-sizing: border-box;
    height: calc(100vh - 84px);
    grid-template-rows: repeat(3, 1fr);
    grid-gap: 8px;
}

.top {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 8px;
}

.center {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.bottom {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.lendge {
    display: flex;

}

.lendge-finish {
    font-family: Microsoft YaHei, Microsoft YaHei;
    font-weight: 400;
    font-size: 14px;
    color: #333333;
    line-height: 19px;
    height: 19px;
    position: relative;
    padding-left: 4px;
    margin-right: 25px;

    &::after {
        position: absolute;
        content: "";
        width: 16px;
        height: 16px;
        background-color: #23B500;
        left: -16px;
        top: 2px;
    }
}

.lendge-nofinish {
    font-family: Microsoft YaHei, Microsoft YaHei;
    font-weight: 400;
    height: 19px;
    font-size: 14px;
    color: #333333;
    line-height: 19px;
    padding-left: 10px;
    position: relative;

    &::after {
        position: absolute;
        content: "";
        width: 16px;
        height: 16px;
        background-color: #0085D5;
        left: -9px;
        top: 2px;
    }
}

.top-left {
    display: grid;
    grid-template-rows:51px auto;


    .top-left-chart-box {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        height: 100%;
        background-color: #F3FAFF;
        padding: 0px 9px;
    }
}

.top-center {
    display: grid;
    grid-template-rows:51px auto;

    .top-center-chart-box {
        background-color: #F3FAFF;
        height: 100%;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2,1fr);
        background-image: url('~@/assets/images/board-bg.png');
        background-repeat: no-repeat;
        background-position: right;
        background-size: 140px auto;
    }

    .top-center-chart1 {
        height: 100%;
    }
}


.top-right {
    display: grid;
    grid-template-rows:51px auto;
}

.box {
    background: #fff;
    padding: 0px 9px 9px;

}

.top-center-chart-box {
    background: #F3FAFF;
    height: 100%;
    width: 100%;
}

.top-center-chart1,
.top-right-chart1,
.center-left-chart1 {
    height: 100%;
}

.top-right-chart-box ,.center-left-chart-box {
    height: 100%;
    width: 100%;
}


.center-left,.center-right,.bottom-left,.bottom-right{
    display: grid;
    grid-template-rows:51px auto;
}

.title-label{
    position: relative;
    height: 19px;
    font-family: Microsoft YaHei, Microsoft YaHei;
    font-weight: 400;
    font-size: 14px;
    color: #333333;
    line-height: 19px;
    padding-left: 24px;

}
.t1::after{
    position: absolute;
    content: "";
    width: 16px;
    height: 16px;
    background-color: #0085D5;
    left: 0px;
    top: 2px;
}
.t31::after{
    position: absolute;
    content: "";
    width: 16px;
    height: 16px;
    background-color: #23B500;
    left: 0px;
    top: 2px;
}
.t61::after{
    position: absolute;
    content: "";
    width: 16px;
    height: 16px;
    background-color: #F2BC7D;
    left: 0px;
    top: 2px;
}

.t91::after{
    position: absolute;
    content: "";
    width: 16px;
    height: 16px;
    background-color: #A3DFEF;
    left: 0px;
    top: 2px;
}
.t120::after{
    position: absolute;
    content: "";
    width: 16px;
    height: 16px;
    background-color: #F99600;
    left: 0px;
    top: 2px;
}

.top-center--box{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 2px;
    height: 60%;
}

.top-right-item{
    display: flex;
    align-items: center;
   padding-left: 10px;
    .top-right-item-txt{
        height: 24px;
        font-family: PingFang SC, PingFang SC;
        font-weight: 400;
        font-size: 14px;
        color: #00051C;
        padding-right: 10px;
  
    }
    .top-right-item-progress{
        height: 15px;
        background: #F7F8FC;
        border-radius: 0px 8px 8px 0px;
        border: 1px solid rgba(0,0,0,0);
        flex: 1;
    }
    .top-right-item-num{
        width: 60px;
        padding-left: 10px;
    }

}

.progress-bg{
    height: 100%;
}
.top-right-chart1{
    display: grid;
    grid-template-rows: auto;
}
</style>